# -*- coding: utf-8 -*-
import scrapy
from xinlang.items import XinlangItem

class XinwenSpider(scrapy.Spider):
    name = 'xinwen'
    allowed_domains = ['news.sina.com.cn']
    start_urls = ['https://news.sina.com.cn/china/']

    def parse(self, response):
        lis=response.xpath('//div[@style="display:none;"]/ul/li')
        for li in lis:
            item=XinlangItem()
            name=li.xpath('./a/text()').extract()[0]
            link=li.xpath('./a/@href').extract()[0]
            item['name']=name
            item['link']=link

            yield item
